package com.xxl.job.executor.dao;

import com.xxl.job.executor.entity.AllData;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface DataMapper {

    @Select("select * from  ST_GAT_TRANS_SRC")
    @Results({
            @Result(property = "NO",column = "NO"),
            @Result(property = "SID",column = "SID"),
            @Result(property = "BBH",column = "BBH"),
            @Result(property = "DWDM",column = "DWDM"),
            @Result(property = "DWMC",column = "DWMC"),
            @Result(property = "JLS",column = "JLS"),
            @Result(property = "SCSJ",column = "SCSJ"),
            @Result(property = "SJBBH",column = "SJBBH"),
            @Result(property = "GATJMJZZSLH",column = "GATJMJZZSLH"),
            @Result(property = "GMSFHM",column = "GMSFHM"),
            @Result(property = "XM",column = "XM"),
            @Result(property = "XBDM",column = "XBDM"),
            @Result(property = "CSRQ",column = "CSRQ"),
            @Result(property = "SSXQDM",column = "SSXQDM"),
            @Result(property = "DZMC",column = "DZMC"),
            @Result(property = "SDXP",column = "SDXP"),
            @Result(property = "ZWY_ZWTXSJ",column = "ZWY_ZWTXSJ"),
            @Result(property = "ZWY_ZWTZSJ",column = "ZWY_ZWTZSJ"),
            @Result(property = "ZWE_ZWTXSJ",column = "ZWE_ZWTXSJ"),
            @Result(property = "ZWE_ZWTZSJ",column = "ZWE_ZWTZSJ"),
            @Result(property = "QFJG_GAJGMC",column = "QFJG_GAJGMC"),
            @Result(property = "GATJMJZZYXQQSRQ",column = "GATJMJZZYXQQSRQ"),
            @Result(property = "GATJMJZZYXQJZRQ",column = "GATJMJZZYXQJZRQ"),
            @Result(property = "QFCS",column = "QFCS"),
            @Result(property = "TXZHM",column = "TXZHM"),
            @Result(property = "GATJMJZZSLYYDM",column = "GATJMJZZSLYYDM"),
            @Result(property = "GATJMJZZZZLXDM",column = "GATJMJZZZZLXDM"),
            @Result(property = "GATJMJZZLZFSDM",column = "GATJMJZZLZFSDM"),
            @Result(property = "SJR_XM",column = "SJR_XM"),
            @Result(property = "SJR_LXDH",column = "SJR_LXDH"),
            @Result(property = "SJR_YZBM",column = "SJR_YZBM"),
            @Result(property = "SJR_TXDZ",column = "SJR_TXDZ"),
    })
    List<AllData> selectAll();

@Insert("insert into ST_GAT_TRANS_SRC" +
        "(NO,SID,BBH,DWDM,DWMC,JLS,SCSJ,SJBBH," +
        "GATJMJZZSLH,GMSFHM,XM,XBDM,CSRQ,SSXQDM,DZMC,SDXP,ZWY_ZWTXSJ,ZWY_ZWTZSJ," +
        "ZWE_ZWTXSJ,ZWE_ZWTZSJ,QFJG_GAJGMC,GATJMJZZYXQQSRQ,GATJMJZZYXQJZRQ," +
        "QFCS,TXZHM,GATJMJZZSLYYDM,GATJMJZZZZLXDM,GATJMJZZLZFSDM,SJR_XM,SJR_LXDH," +
        "SJR_YZBM,SJR_TXDZ)" +
        "values(#{NO},#{SID},#{BBH},#{DWDM},#{DWMC},#{JLS},to_date(#{SCSJ},'yyyy-mm-dd hh24:mi:ss'),#{SJBBH}," +
        "#{GATJMJZZSLH},#{GMSFHM},#{XM},#{XBDM},to_date(#{CSRQ},'yyyy-mm-dd'),#{SSXQDM},#{DZMC},#{SDXP},#{ZWY_ZWTXSJ},#{ZWY_ZWTZSJ}," +
        "#{ZWE_ZWTXSJ},#{ZWE_ZWTZSJ},#{QFJG_GAJGMC},#{GATJMJZZYXQQSRQ},#{GATJMJZZYXQJZRQ}," +
        "#{QFCS},#{TXZHM},#{GATJMJZZSLYYDM},#{GATJMJZZZZLXDM},#{GATJMJZZLZFSDM},#{SJR_XM},#{SJR_LXDH}," +
        "#{SJR_YZBM},#{SJR_TXDZ})")
    int insertData(AllData all);

   @Select("select count(*) from ST_GAT_TRANS_SRC where GMSFHM like #{gmsfhm}")
    Integer selectGMSFHM(@Param("gmsfhm") String gmsfhm);

   @Select("select count(*) from ST_GAT_TRANS_SRC")
   Integer selectAllCount();

   @Update("update ST_GAT_TRANS_SRC set NO=#{NO},SID=#{SID},BBH=#{BBH},DWDM=#{DWDM}," +
           "DWMC=#{DWMC},JLS=#{JLS},SCSJ=to_date(#{SCSJ},'yyyy-mm-dd hh24:mi:ss'),SJBBH=#{SJBBH},GATJMJZZSLH=#{GATJMJZZSLH}," +
           "GMSFHM=#{GMSFHM},XM=#{XM},XBDM=#{XBDM},CSRQ=to_date(#{CSRQ},'yyyy-mm-dd'),SSXQDM=#{SSXQDM}," +
           "DZMC=#{DZMC},SDXP=#{SDXP},ZWY_ZWTXSJ=#{ZWY_ZWTXSJ},ZWY_ZWTZSJ=#{ZWY_ZWTZSJ}," +
           "ZWE_ZWTXSJ=#{ZWE_ZWTXSJ},ZWE_ZWTZSJ=#{ZWE_ZWTZSJ},QFJG_GAJGMC=#{QFJG_GAJGMC}," +
           "GATJMJZZYXQQSRQ=#{GATJMJZZYXQQSRQ},GATJMJZZYXQJZRQ=#{GATJMJZZYXQJZRQ}," +
           "QFCS=#{QFCS},TXZHM=#{TXZHM},GATJMJZZSLYYDM=#{GATJMJZZSLYYDM},GATJMJZZZZLXDM=" +
           "#{GATJMJZZZZLXDM},GATJMJZZLZFSDM=#{GATJMJZZLZFSDM},SJR_XM=#{SJR_XM},SJR_LXDH=" +
           "#{SJR_LXDH},SJR_YZBM=#{SJR_YZBM},SJR_TXDZ=#{SJR_TXDZ} where GMSFHM=#{GMSFHM}")
   Integer updateRecord(AllData allData);
}
